import { ApiProperty } from '@midwayjs/swagger';

// ======= 土含与蒸散发反演成果 DTO =======

// 创建土含蒸散发成果DTO
export class CreateSoilEtDto {
  @ApiProperty({ description: '文件名称' })
  fileName: string;

  @ApiProperty({ description: '监测日期', example: '2025-02-10' })
  monitorDate: Date;

  @ApiProperty({ description: '所属灌区', example: '石津灌区' })
  irrigationArea: string;

  @ApiProperty({ description: '成果类型', example: '土含成果' })
  resultType: string;

  @ApiProperty({ description: 'box坐标', required: false })
  box?: string;

  @ApiProperty({ description: '文件路径' })
  filePath: string;

  @ApiProperty({ description: '土壤水类型', example: '表层土壤水' })
  soilWaterType: string;

  @ApiProperty({ description: 'ET类型', example: '实际蒸散发' })
  etType: string;
}

// 更新土含蒸散发成果DTO
export class UpdateSoilEtDto {
  @ApiProperty({ description: '文件名称', required: false })
  fileName?: string;

  @ApiProperty({ description: '监测日期', required: false })
  monitorDate?: Date;

  @ApiProperty({ description: '所属灌区', required: false })
  irrigationArea?: string;

  @ApiProperty({ description: '成果类型', required: false })
  resultType?: string;

  @ApiProperty({ description: 'box坐标', required: false })
  box?: string;

  @ApiProperty({ description: '文件路径', required: false })
  filePath?: string;

  @ApiProperty({ description: '土壤水类型', required: false })
  soilWaterType?: string;

  @ApiProperty({ description: 'ET类型', required: false })
  etType?: string;
}

// 查询土含蒸散发成果DTO
export class SoilEtQueryDto {
  @ApiProperty({ description: '成果类型', required: false, example: '土含成果' })
  resultType?: string;

  @ApiProperty({ description: '所属灌区', required: false, example: '石津灌区' })
  irrigationArea?: string;

  @ApiProperty({ description: '土壤水类型', required: false, example: '表层土壤水' })
  soilWaterType?: string;

  @ApiProperty({ description: 'ET类型', required: false, example: '实际蒸散发' })
  etType?: string;

  @ApiProperty({ description: '开始日期', required: false, example: '2025-02-10' })
  startDate?: Date;

  @ApiProperty({ description: '结束日期', required: false })
  endDate?: Date;

  @ApiProperty({ description: '页码', required: false, default: 1 })
  page?: number = 1;

  @ApiProperty({ description: '每页数量', required: false, default: 10 })
  pageSize?: number = 10;
}

// 返回土含蒸散发成果DTO
export class SoilEtResponseDto {
  @ApiProperty({ description: '序号' })
  id: number;

  @ApiProperty({ description: '文件名称' })
  fileName: string;

  @ApiProperty({ description: '监测日期' })
  monitorDate: Date;

  @ApiProperty({ description: '所属灌区' })
  irrigationArea: string;

  @ApiProperty({ description: '成果类型' })
  resultType: string;

  @ApiProperty({ description: 'box坐标' })
  box?: string;

  @ApiProperty({ description: '文件路径' })
  filePath: string;

  @ApiProperty({ description: '土壤水类型' })
  soilWaterType: string;

  @ApiProperty({ description: 'ET类型' })
  etType: string;

  @ApiProperty({ description: '创建时间' })
  createTime: Date;
}

// ======= 通用响应DTO =======

// 分页响应DTO
export class PageResponseDto<T> {
  @ApiProperty({ description: '数据列表' })
  list: T[];

  @ApiProperty({ description: '总数量' })
  total: number;

  @ApiProperty({ description: '当前页码' })
  page: number;

  @ApiProperty({ description: '每页数量' })
  pageSize: number;

  @ApiProperty({ description: '总页数' })
  totalPages: number;
}

// 通用响应DTO
export class CommonResponseDto<T> {
  @ApiProperty({ description: '状态码' })
  code: number;

  @ApiProperty({ description: '消息' })
  message: string;

  @ApiProperty({ description: '数据' })
  data?: T;

  @ApiProperty({ description: '时间戳' })
  timestamp: number;
}

export class CsvContentResponseDto {
  @ApiProperty({ description: '文件信息' })
  fileInfo: {
    id: string;
    originalName: string;
    fileSize: number;
    createTime: Date;
  };

  @ApiProperty({ description: '列标题' })
  headers: string[];

  @ApiProperty({ description: '数据内容' })
  data: any[];

  @ApiProperty({ description: '分页信息' })
  pagination: {
    page: number;
    pageSize: number;
    total: number;
    totalPages: number;
  };
}

export class CsvStructureDto {
  @ApiProperty({ description: '文件信息' })
  fileInfo: {
    id: string;
    originalName: string;
    fileSize: number;
    createTime: Date;
  };

  @ApiProperty({ description: '列标题' })
  headers: string[];

  @ApiProperty({ description: '总行数' })
  rowCount: number;

  @ApiProperty({ description: '列数据类型' })
  columnTypes: { [key: string]: string };

  @ApiProperty({ description: '样本数据' })
  sampleData: any[];
}